Ext.regModel('File', {
    idProperty: 'id',
    fields: [
        {name: 'id',type: 'string'},
        {name:'text',type:'string'}
    ]
});

var Billcode=window.location.href.split("=")[1];
Ext.setup({
    icon: 'icon.png',
    tabletStartupScreen: 'tablet_startup.png',
    phoneStartupScreen: 'phone_startup.png',
    glossOnIcon: false,
    onReady: function(){

        var store = new Ext.data.TreeStore({
            model: 'File',
            proxy: {
                type: 'ajax',
                url: 'companyaction.action',
                reader: {
                    type: 'tree',
                    root:'countryList'
                }
            }
        });
        
        var nestedList = new Ext.NestedList({
            fullscreen: true,
            title: '企业通讯录',
            displayField: 'text',
            // add a / for folder nodes in title/back button
            getTitleTextTpl: function() {
                return '{' + this.displayField + '}<tpl if="leaf !== true"></tpl>';
            },
            // add a / for folder nodes in the list
            getItemTextTpl: function() {
                //return '{' + this.displayField + '}<tpl if="leaf !== true"></tpl>';
            	return '<div class="contact2"><strong>{'+ this.displayField +'}</strong></div>'  ;
            },
            store: store,
        });
        
        nestedList.on('leafitemtap', function(subList, subIdx, el, e, detailCard) {
        	var ds = subList.getStore(),
                r  = ds.getAt(subIdx);
        	var temp = nestedList.getActiveItem();
        	window.location.href='../companyusers/companygroup.jsp?groupid='+r.data.id;
        });
    }
});